import { generateRandomId } from '@/utils';

export const editConfig: PageConfig = {
    items: [
        {
            itemType: 'text',
            modelKey: 'orderNumber',
            elInputProps: {
                disabled: true
            },
            columnProps: {
                label: '订单号'
            },
            validProps: {
                id: generateRandomId(),
                required: true
            }
        },
        {
            itemType: 'number',
            modelKey: 'orderQuantity',
            elInputNumberProps: {
                placeholder: '请输入订单数量',
                controls: false,
                max: 9999999,
                min: 1,
                precision: 0
            },

            columnProps: {
                label: '产品数量'
            },
            validProps: {
                id: generateRandomId(),
                required: true
            }
        },

        {
            itemType: 'select',
            modelKey: 'itemCode',
            slotName: 'itemCode',
            columnProps: {
                label: '物料编码'
            },
            validProps: {
                id: generateRandomId(),
                required: true
            }
        },
        {
            itemType: 'text',
            modelKey: 'itemName',
            elInputProps: {
                disabled: true,
                placeholder: '请输入'
            },
            columnProps: {
                label: '物料名称'
            },
            validProps: {
                id: generateRandomId(),
                required: true
            }
        },
        {
            itemType: 'select',
            modelKey: 'customerCode',
            slotName: 'customerCode',
            columnProps: {
                label: '客户编码'
            },
            validProps: {
                id: generateRandomId()
            }
        },
        {
            itemType: 'text',
            modelKey: 'customerCompanyName',
            elInputProps: {
                disabled: true,
                placeholder: '请输入'
            },
            columnProps: {
                label: '客户公司名称'
            },
            validProps: {
                id: generateRandomId()
            }
        },

        {
            itemType: 'date',
            modelKey: 'orderDate',
            elInputProps: {
                disabled: true
            },
            columnProps: {
                label: '下单日期'
            },
            validProps: {
                id: generateRandomId(),
                required: true
            }
        },

        {
            itemType: 'date',
            modelKey: 'orderDeliveryDate',
            elDatePickerProps: {
                disabledDate: (time: Date) => {
                    return time < new Date(Date.now() - 86400000);
                }
            },
            columnProps: {
                label: '订单交期'
            },
            validProps: {
                id: generateRandomId(),
                required: true
            }
        },
        {
            itemType: 'select',
            modelKey: 'orderPriority',
            elSelectProps: {
                placeholder: '请选择订单优先级',
                options: [
                    { label: '1', value: 1 },
                    { label: '2', value: 2 },
                    { label: '3', value: 3 },
                    { label: '4', value: 4 },
                    { label: '5', value: 5 },
                    { label: '6', value: 6 },
                    { label: '7', value: 7 },
                    { label: '8', value: 8 },
                    { label: '9', value: 9 },
                    { label: '10', value: 10 }
                ]
            },
            columnProps: {
                label: '订单优先级'
            },
            validProps: {
                id: generateRandomId(),
                required: true
            },
            otherConfig: {
                tip: true,
                tipMsg: '优先级越高，数字越小。'
            }
        }
    ],
    labelWidth: 120
};
